package com.googlecode.afdbaccess.web.common.interceptors;

import javax.interceptor.InvocationContext;
import javax.servlet.http.HttpServletRequest;

public class InterceptorsCommon {
    public static String getPageDescription(HttpServletRequest request) {
        return request.getServletPath() + (request.getAttribute("javax.servlet.include.request_uri")!=null ? " -> " + request.getAttribute("javax.servlet.include.request_uri"):"");
    }
    
    public static HttpServletRequest findRequest(InvocationContext invocationContext) {
        for(Object parameter:invocationContext.getParameters()) {
            if(parameter instanceof HttpServletRequest) {
                return (HttpServletRequest)parameter;
            }
        }
    
        return null;
    }
    
}

